package com.boot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.context.annotation.Bean;

@EnableDiscoveryClient
@SpringBootApplication
public class GateWayMain {
    public static void main(String[] args) {

        SpringApplication.run(GateWayMain.class, args);
    }

    @Bean
    public GlobalFilter debugFilter() {
        return (exchange, chain) -> {
            System.out.println("=== 请求进入网关 ===");
            System.out.println("Path: " + exchange.getRequest().getPath());
            return chain.filter(exchange);
        };
    }
}